# -*- coding: utf-8 -*-

########## 一些定义 ##########
## 一些提示列表
tips=[
    '请输入一个数字: ',
    '请输入正确的数字(整数/小数): ',
    '除数不能为0: ',  
    '请输入一个运算符(+ - * /): ',
    '请输入正确的运算符(+ - * /): ',      
    '是否继续计算(Yy/Nn): ',
]


## 操作符集合
opts={'+', '-', '*', '/'}


def calc01():
    reply = 'Y'
    while reply.upper() == 'Y':
        # 数字1的逻辑
        num01 = input(tips[0])
        # 做整数的判断
        if num01.isdigit():
            n1 = int(num01)
        else:
            try:
                # 做小数的判断
                if float(num01):
                    n1 = float(num01)
            except:
                print(tips[1])
                break

        # 运算符的逻辑
        operator = input(tips[3])
        if operator not in opts:
            print(tips[4])
            break
        
        # 数字2的逻辑
        num02 = input(tips[0])
        
        # 除法时，除数不为0的判断
        if operator == "/":
            if num02 == "0":
                print(tips[2])
                break
        
        # 做整数的判断
        if num02.isdigit():
            n2 = int(num02)
        else:
            try:
                # 做小数的判断
                if float(num02):
                    n2 = float(num02)
            except:
                print(tips[1])
                break 
        
        # 做运算
        for i in operator:
            if i == "+":
                print(n1 + n2)
            elif i == "-":
                print(n1 - n2)
            elif i == "*":
                print(n1 * n2)
            elif i == "/":
                print(n1 / n2)
        
        reply = input(tips[5])
    print('Bye')


calc01()
